package com.summer.filesync.config;

/** 系统配置常量 定义所有配置项的键名 */
public class SystemConfig {

  // 网络配置
  public static final String NETWORK_PORT = "network.port";
  public static final String NETWORK_TIMEOUT = "network.timeout";
  public static final String MAX_CONNECTIONS = "network.max_connections";
  public static final String HEARTBEAT_INTERVAL = "network.heartbeat_interval";

  // 同步配置
  public static final String SYNC_INTERVAL = "sync.interval";
  public static final String CONFLICT_STRATEGY = "sync.conflict_strategy";
  public static final String WATCH_DIRECTORIES = "sync.watch_directories";
  public static final String AUTO_SYNC_ENABLED = "sync.auto_enabled";
  public static final String SYNC_THREAD_POOL_SIZE = "sync.thread_pool_size";

  // 数据库配置
  public static final String DB_PATH = "database.path";
  public static final String DB_POOL_SIZE = "database.pool_size";
  public static final String DB_CONNECTION_TIMEOUT = "database.connection_timeout";

  // 文件传输配置
  public static final String TRANSFER_CHUNK_SIZE = "transfer.chunk_size";
  public static final String TRANSFER_TIMEOUT = "transfer.timeout";
  public static final String MAX_FILE_SIZE = "transfer.max_file_size";
  public static final String TRANSFER_THREAD_POOL_SIZE = "transfer.thread_pool_size";

  // 日志配置
  public static final String LOG_LEVEL = "log.level";
  public static final String LOG_FILE_PATH = "log.file_path";
  public static final String LOG_FILE_ENABLED = "log.file_enabled";
  public static final String LOG_MAX_FILE_SIZE = "log.max_file_size";

  // 节点配置
  public static final String NODE_ID = "node.id";
  public static final String NODE_NAME = "node.name";
  public static final String NODE_VERSION = "node.version";

  // 冲突解决策略
  public static final class ConflictStrategy {
    public static final String TIMESTAMP_PRIORITY = "TIMESTAMP_PRIORITY";
    public static final String SIZE_PRIORITY = "SIZE_PRIORITY";
    public static final String MANUAL_RESOLVE = "MANUAL_RESOLVE";
    public static final String KEEP_BOTH = "KEEP_BOTH";
  }

  // 默认值
  public static final class Defaults {
    public static final int NETWORK_PORT = 8888;
    public static final int NETWORK_TIMEOUT = 30000;
    public static final int MAX_CONNECTIONS = 10;
    public static final int HEARTBEAT_INTERVAL = 30000;

    public static final int SYNC_INTERVAL = 60000;
    public static final String CONFLICT_STRATEGY = ConflictStrategy.TIMESTAMP_PRIORITY;
    public static final String WATCH_DIRECTORIES = "sync";
    public static final boolean AUTO_SYNC_ENABLED = true;
    public static final int SYNC_THREAD_POOL_SIZE = 5;

    public static final String DB_PATH = "database/sync_system.db";
    public static final int DB_POOL_SIZE = 5;
    public static final int DB_CONNECTION_TIMEOUT = 30000;

    public static final int TRANSFER_CHUNK_SIZE = 8192;
    public static final int TRANSFER_TIMEOUT = 120000;
    public static final long MAX_FILE_SIZE = 104857600L; // 100MB
    public static final int TRANSFER_THREAD_POOL_SIZE = 3;

    public static final String LOG_LEVEL = "INFO";
    public static final String LOG_FILE_PATH = "logs/system.log";
    public static final boolean LOG_FILE_ENABLED = true;
    public static final long LOG_MAX_FILE_SIZE = 10485760L; // 10MB

    public static final String NODE_NAME = "SyncNode";
    public static final String NODE_VERSION = "1.0.0";
  }

  // 私有构造器，防止实例化
  private SystemConfig() {
    throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
  }
}
